package com.hornsun.domain.constant.error;

/**
 * Created by 编译中... on 2018/8/2.
 */
public enum  CommonError  {

    NOT_LOGIN(666,"没有登录"),
    BAD_PARAM(10001,"参数异常"),
    NOT_EXIST(10002,"不存在"),
    HAS_EXIST(10003,"已存在"),
    FAILED(10004,"失败"),
    HAS_FINISH(10005,"已完成"),
    NO_PERMISSION(777,"没权限");

    private Integer code;
    private String content;

    CommonError(Integer code ,String content){this.code=code;this.content=content;}

    public Integer getCode() {
        return code;
    }

    public String getContent() {
        return content;
    }

    public static CommonError commonErrorByContent(String content) {
        for (CommonError commonError : values()) {
            if (commonError.content.equals(content)){
                return commonError;
            }
        }
        return null;
    }
}
